package com.elysium.autoconfigure;

import com.elysium.config.SaTokenConfigure;
import com.elysium.config.StpInterfaceImpl;
import com.elysium.interceptor.FeignTokenInterceptor;
import com.elysium.properties.SaTokenSettingProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.RedisTemplate;

@Configuration
@EnableConfigurationProperties({SaTokenSettingProperties.class})
public class SaTokenCustomizationAutoConfiguration {

    @Bean
    public SaTokenConfigure saTokenConfigure() {
        return new SaTokenConfigure();
    }

    @Bean
    public StpInterfaceImpl stpInterface(RedisTemplate redisTemplate, SaTokenSettingProperties saTokenSettingProperties) {
        return new StpInterfaceImpl(redisTemplate, saTokenSettingProperties);
    }

    @Bean
    public FeignTokenInterceptor feignTokenInterceptor(){
        return new FeignTokenInterceptor();
    }

}
